@extends('layout.admin.master')
@section('content')
    <div class="card">
        <div class="card-body">
            <ul class="nav nav-tabs nav-tabs-sm">
                <li class="nav-item">
                    <a href="{{route('permission.permission.index')}}" class="nav-link active">
                        权限列表列表
                    </a>
                </li>
            </ul>
            <form action="{{route('permission.permission.setingPermission',$role)}}" method="post">
                @csrf
                @foreach($modules as$k=> $module)
                    <div class="card">
                        <div class="card-header">
                            {{$module->cname}}
                        </div>
                        <div class="card-body">
                            <div class="row">
                                @foreach($module->permissions as$kk=> $permission)
                                    <div class="col-3">
                                        <div class="form-check">
                                            <input name="permission[]" class="form-check-input" type="checkbox"
                                                   id="permission{{$k}}{{$kk}}" value="{{$module['name'].'-'.$permission['name']}}" @if($role->hasPermissionTo($module['name'].'-'.$permission['name']))  checked @endif>
                                            <label class="form-check-label" for="permission{{$k}}{{$kk}}">
                                                <strong>{{$permission['cname']}}</strong> | <span
                                                        class="info">{{$permission['name']}}</span>
                                            </label>
                                        </div>
                                    </div>
                                @endforeach
                            </div>
                        </div>
                    </div>
                @endforeach
                <div class="card-footer text-muted">
                    <button type="submit" class="btn btn-primary">保存数据</button>
                </div>
            </form>
        </div>
    </div>
@endsection
